Optimal. Leaf size=85 \[ -4 i a^3 x-\frac {4 a^3 \log (\cos (c+d x))}{d}+\frac {2 i a^3 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 85, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 22, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3608, 3559,
3558, 3556} \begin {gather*} \frac {2 i a^3 \tan (c+d x)}{d}-\frac {4 a^3 \log (\cos (c+d x))}{d}-4 i a^3 x+\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3558
Rule 3559
Rule 3608
Rubi steps
\begin {align*} \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx &=\frac {(a+i a \tan (c+d x))^3}{3 d}-i \int (a+i a \tan (c+d x))^3 \, dx\\ &=\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d}-(2 i a) \int (a+i a \tan (c+d x))^2 \, dx\\ &=-4 i a^3 x+\frac {2 i a^3 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d}+\left (4 a^3\right ) \int \tan (c+d x) \, dx\\ &=-4 i a^3 x-\frac {4 a^3 \log (\cos (c+d x))}{d}+\frac {2 i a^3 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(178\) vs. \(2(85)=170\).
time = 0.89, size = 178, normalized size = 2.09 \begin {gather*} -\frac {i a^3 \sec (c) \sec ^3(c+d x) \left (6 d x \cos (2 c+3 d x)+6 d x \cos (4 c+3 d x)+9 \cos (d x) \left (-i+2 d x-i \log \left (\cos ^2(c+d x)\right )\right )+9 \cos (2 c+d x) \left (-i+2 d x-i \log \left (\cos ^2(c+d x)\right )\right )-3 i \cos (2 c+3 d x) \log \left (\cos ^2(c+d x)\right )-3 i \cos (4 c+3 d x) \log \left (\cos ^2(c+d x)\right )-24 \sin (d x)+15 \sin (2 c+d x)-13 \sin (2 c+3 d x)\right )}{12 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.05, size = 62, normalized size = 0.73
method | result | size |
derivativedivides | \(\frac {a^{3} \left (4 i \tan \left (d x +c \right )-\frac {i \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {3 \left (\tan ^{2}\left (d x +c \right )\right )}{2}+2 \ln \left (1+\tan ^{2}\left (d x +c \right )\right )-4 i \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) | \(62\) |
default | \(\frac {a^{3} \left (4 i \tan \left (d x +c \right )-\frac {i \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {3 \left (\tan ^{2}\left (d x +c \right )\right )}{2}+2 \ln \left (1+\tan ^{2}\left (d x +c \right )\right )-4 i \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) | \(62\) |
norman | \(-\frac {3 a^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}-4 i a^{3} x +\frac {4 i a^{3} \tan \left (d x +c \right )}{d}-\frac {i a^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 a^{3} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) | \(76\) |
risch | \(\frac {8 i a^{3} c}{d}-\frac {2 a^{3} \left (24 \,{\mathrm e}^{4 i \left (d x +c \right )}+33 \,{\mathrm e}^{2 i \left (d x +c \right )}+13\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {4 a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(77\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 69, normalized size = 0.81 \begin {gather*} -\frac {2 i \, a^{3} \tan \left (d x + c\right )^{3} + 9 \, a^{3} \tan \left (d x + c\right )^{2} + 24 i \, {\left (d x + c\right )} a^{3} - 12 \, a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 24 i \, a^{3} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.48, size = 134, normalized size = 1.58 \begin {gather*} -\frac {2 \, {\left (24 \, a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 33 \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + 13 \, a^{3} + 6 \, {\left (a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + a^{3}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.22, size = 131, normalized size = 1.54 \begin {gather*} - \frac {4 a^{3} \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 48 a^{3} e^{4 i c} e^{4 i d x} - 66 a^{3} e^{2 i c} e^{2 i d x} - 26 a^{3}}{3 d e^{6 i c} e^{6 i d x} + 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} + 3 d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 170 vs. \(2 (73) = 146\).
time = 0.59, size = 170, normalized size = 2.00 \begin {gather*} -\frac {2 \, {\left (6 \, a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 24 \, a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 33 \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + 6 \, a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 13 \, a^{3}\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.73, size = 59, normalized size = 0.69 \begin {gather*} \frac {4\,a^3\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )+a^3\,\mathrm {tan}\left (c+d\,x\right )\,4{}\mathrm {i}-\frac {3\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2}-\frac {a^3\,{\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}}{3}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________